<?php
class OpenSocialContainerUser {

	var $userid= "";
	var $id = "";
	var $container_id = "";

	public function __construct($userid=""){
		$this->userid=$userid;
		if($this->userid!=""){
			$this->parse($this->userid);
		}
	}

	public function parse($userid){
	 if(strpos($userid,'@')=== false) throw new Exception('Userid not valid, no @ sign found!');
	 $parts = split('@',$userid);
	 if(count($parts)!=2) throw new Exception('Userid not valid! split on @, no 2 parts)');
	 $this->setId($parts[0]);
	 $this->setContainerId($parts[1]);
	 return true;
	}

	public function setContainerId($container_id){
		$this->container_id = $container_id;
	}
	
	public function setId($id){
		$this->id = $id;
	}	
	
	public function getContainerId(){
		return $this->container_id;
	}
	
	public function getId(){
		return $this->id;
	}
	
}